package client.unknow;

import pack.ServerToClient;

public class PackFactory {
	private DoAble doAble;

	public PackFactory(DoAble doAble) {
		this.doAble = doAble;
	}

	public void process(ServerToClient clientReceivePack) {
		switch (clientReceivePack.getOperate()) {
		case INITIAL:
			doAble.receive(clientReceivePack.getMessage());
			break;
		case RECEIVE:
			doAble.receive(clientReceivePack.getMessage());
			break;
		case UPDATEUSER:
			doAble.update(clientReceivePack.getMessage());
			break;
		case SENDMESSAGETOONE:
			doAble.showMessage(clientReceivePack);
			break;
		case SENDMESSAGETOALL:
			doAble.showMessageAll(clientReceivePack);
			break;
		}
	}
}
